@echo off
cls
rem INTRODUCING TWITCH BACKUP SUPREME! 
rem
rem I have removed the ability to run from a network drive, because it conflicted with the youtube-dl --update feature.
rem
rem The first commands "@echo off" and cls mutes the unnecessary text in this script from displaying in the script/batch/.bat command window.
rem
rem Below we set the %RootFolderName% variable to equal the current/root folder/directory holding this script. The user needs to manually name the root folder after the Twitch streamer's username. This is used to point the file downloader at the desired Twitch stream. We use two variableshere for readability and future maintainability.
rem
set FindRootFolder=%~p0
set FindRootFolder=%FindRootFolder:~0,-1%
for %%A in ("%FindRootFolder%") do (Set RootFolderName=%%~nxA)
set StreamerUsername=%RootFolderName%
rem 
rem Below we set the %DownloadFolderName% variable. The folder name is needed twice, so making it a variable in one place reduces the chance of human error editing this script in the future. We name the folder after the current script file name. We use two variables here for readability and future maintainability.
rem
set CurrentFileName=%~n0
set DownloadFolderName=%CurrentFileName%
rem
rem Below we name the command window, and print what it is doing.
rem
title Twitch_Backup_Supreme - %DownloadFolderName%
echo Running Twitch Backup Supreme ...
rem
@echo ***
@echo *** The first time you use Twitch Chat Downloader, you must login by entering your Twitch Client ID and Secret! 
@echo *** This private info is saved in the settings.json file for future script runs.
@echo *** Visit: https://dev.twitch.tv/console/apps to find your Twitch Client ID and Secret.
@echo ***
rem Putting ".\" before a file/folder is a shortcut for the current path of where this script is. 
rem tct-settings.json is customized to hold the file name output format at the bottom of the irc -> output section: "format": "{created_at} - {view_count} views - {title} - {user_name} - (ID {id}).log"
..\tcd.exe --output ".\%DownloadFolderName%" --channel "%RootFolderName%" --settings-file ..\tcd-settings.json --format irc --first 99999
rem
rem Below the final "pause" command keeps the .bat command window open after the work is done so you can see what happened. You can remove this pause if you want the window to close automatically.
rem
pause